package com.leetcode;

/**
 * MatrixRotate..旋转矩阵
 *
 * @author Lizhong
 * @date 2019/9/5
 */
public class MatrixRotate {
    public void rotate(int[][] matrix) {
        int len = matrix[0].length;
        for (int i = 0; i < len; i++) {
            for (int j = i+1; j < len; j++) {

                int temp=matrix[i][j];
                matrix[i][j]=matrix[j][i];
                matrix[j][i]=temp;
            }
        }
        for (int i = 0; i < len; i++) {
            for (int j = 0; j < len/2; j++) {
                int temp=matrix[i][j];
                matrix[i][j]=matrix[i][len-j-1];
                matrix[i][len-j-1]=temp;
            }
        }
    }

}
